<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip="">
    <xi:include href="tb-header.html" />
    <xi:include href="tb-sidebar.html" />
    <xi:include href="tb-addressform.html" />
    <xi:include href="tb-footer.html" />
<?python
from tg.i18n import get_lang
from tg import url
from babel.dates import format_date
?>

<py:def function="tb_sidebar">
<div style="margin-left:5px;margin-right:5px;">
	<div py:if="defined('team')" id="post_content" class="ui-corner-all" >
		<a href="${root_url}/post/sitemap/${team.team_alias}">Sitemap</a>
	</div>
	<div id="post_content" class="ui-corner-all" >
	<h5>Add</h5>
	<ul>
		<li><a onclick="return create('${root_url}/team/add', {modal: true});" href="">Team</a></li>
		<li><a onclick="return create('${root_url}/category/add', {modal: true});" href="">Category</a></li>
		<li py:if="defined('team')"><a onclick="return create('${root_url}/post/select_category_boxy/${team.team_alias}', {modal: true});" href="">Post</a></li>
		<li py:if="defined('post')"><a onclick="return create('${root_url}/category/add_field/${team.team_alias}/${post.post_category_id}', {modal: true});" href="">Field</a></li>
		<li py:if="defined('post')"><a onclick="return create('${root_url}/post/select_category_boxy/${team.team_alias}/${post.post_id}', {modal: true});" href="">Child</a></li>
	</ul>
	</div>

	<div py:if="defined('post')" id="post_content" class="ui-corner-all">
	<h5>Show</h5>
	<ul>
		<li py:if="post.parent">
			<div><a href="${root_url}/post/index/${team.team_alias}/${post.parent.post_id}">Parent</a></div>
			<i class="small">${post.parent.post_title}</i>
		</li>
	</ul>
	</div>
</div>

</py:def>

<py:def function="sitemap(plist)">
	<ul py:if="plist">
		<li py:for="c in plist">
			<a href="${root_url}/post/index/${team.team_alias}/${c.post_id}"> ${c.post_title}</a>
			<span><i>(${c.post_category.category_label} ${format_date(c.post_date, format='long', locale=get_lang()[0])})</i></span>
			${sitemap(c.childs)}
		</li>
	</ul>
</py:def>

<head py:match="head" py:attrs="select('@*')">
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title py:replace="''">Your title goes here</title>
  	${tmpl_context.pack()}
    <meta py:replace="select('*')"/>

</head>

<body py:match="body" py:attrs="select('@*')">

<div id="toolbox_wrapper">
	${tb_header()}
	<div id="toolbox_main">
		<table><tbody>
			<tr>
				<td id="toolbox_sidebar">
						<div style="text-align:center;">
						<img style="text-align:center;width:100px;" alt="logo" src="/images/logo.png" />
						</div>
						${tb_sidebar()}
				</td>
				<td id="toolbox_content" class="ui-corner-all">
						<py:with vars="flash=tg.flash_obj.render('flash', use_js=False)">
							<div py:if="flash" py:content="XML(flash)" />
						</py:with>
						<div id="toolbox_content_body">
							<div py:replace="select('*|text()')"/>
						</div>
				</td>
			</tr>
		</tbody></table>
	</div>
	${tb_footer()}
</div>
</body>
</html>
